//====================================================================================================
// Filename:	WinMain.cpp
// Created by:	Peter Chan
// Description:	Hello Animation demo.
//====================================================================================================

//====================================================================================================
// Includes
//====================================================================================================

#include <SGE.h>
using namespace SGE;

#include "Character.h"
#include "Map.h"
#include "Diamond.h"
#include "PlayState.h"
#include "FrontendState.h"+


GameContext gameContext;
GameState* currentState = nullptr;
NextState nextState = Frontend;

void SGE_Initialize()
{
	
}

void SGE_Terminate()
{
}

bool SGE_Update(float deltaTime) 
{
	if(nextState != None)
	{
		//Unload current state
		if(currentState != nullptr)
		{
			currentState -> Unload();
		}

		//change state
		switch (nextState)
		{
		case Frontend:
			currentState = new FrontendState(gameContext);
			break;
		case Gameplay:
			currentState = new PlayState(gameContext);
			break;
		}

		//Load new state
		currentState -> Load();
	}

	nextState = currentState -> Update(deltaTime);
	if(nextState == Quit) 
	{
		currentState -> Unload();
		delete currentState;
		return true;
	}
	return false;
}

void SGE_Render()
{	
	currentState -> Render();
}